<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="csc.nndp.dao.User"%>
<%@page import="java.util.*;"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">



<%
	if (session.getAttribute("admin") != null) {
		response.sendRedirect("logon.jsp");
	}
%>
<html>
<head>

<link rel="stylesheet"
	href="http://voky.com.ua/showcase/sky-forms/examples/css/demo.css">
<link rel="stylesheet"
	href="http://voky.com.ua/showcase/sky-forms/examples/css/sky-forms.css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>View All User</title>
</head>
<body class="bg-purple">

	<div style="clear: both; width: 800px;">
		<table border="1">
			<tr bgcolor="#FFAD00">
				<th><input type="checkbox" name="ID" value="All" /></th>
				<th>ID User</th>
				<th>UserName</th>
				<th>Password</th>
				<th>Firstname</th>
				<th>Lastname</th>
				<th>Phone</th>
				<th>Email</th>
				<th>Role</th>

			</tr>

			<c:forEach var="e" items="${users}">
				<tr>
					<td><input type="checkbox" name="ID" value="${e.userId }" /></td>
					<td>${e.userId}&nbsp;&nbsp;</td>
					<td>${e.userName}&nbsp;&nbsp;</td>
					<td>${e.password}&nbsp;&nbsp;</td>
					<td>${e.firstName }&nbsp;&nbsp;</td>
					<td>${e.lastName }&nbsp;&nbsp;</td>
					<td>${e.phone}&nbsp;&nbsp;</td>
					<td>${e.email}&nbsp;&nbsp;</td>
					<td>${e.role}&nbsp;&nbsp;</td>

					<td><c:choose>
							<c:when test="${e.role =='admin' || e.role =='user'}">
								<a href="edit-user?userId=${e.userId }">Edit</a>
							</c:when>
							<c:otherwise>Edit</c:otherwise>
						</c:choose></td>

					<td><c:choose>
							<c:when test="${e.role =='admin' || e.role =='user'}">
								<a href="delete-user?userId=${e.userId }">Delete</a>
							</c:when>
							<c:otherwise>Edit</c:otherwise>
						</c:choose></td>
				</tr>


			</c:forEach>
		</table>
		<br /> <input type="button" name="adduser" value="Add"
			onclick="window.location.href='addUser.jsp'" />
	</div>


</body>
</html>